﻿using System;
using System.Web.UI.WebControls;

namespace DotNetNuke.Modules.UserDefinedTable
{


  public class DataTypeDecimal : DataType
  {


    public override void SetStylesAndFormats(BoundField Column, string Format)
    {
      if ( string.IsNullOrEmpty(Format) )
      {
        Column.DataFormatString = "{0:#,###,##0.0###}";
      }
      else
      {
        Column.DataFormatString = string.Format("{{0:{0}}}", Format);
      }
      Column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
      Column.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
    }

    public override string Name
    {
      get
      {
        return "Decimal";
      }
    }

    public override string SupportedCasts
    {
      get
      {
        return string.Format("{0}|Currency", base.SupportedCasts);
      }
    }

    public override bool SupportsDefaultValue
    {
      get
      {
        return true;
      }
    }

    public override bool SupportsEditing
    {
      get
      {
        return true;
      }
    }

    public override bool SupportsEditStyle
    {
      get
      {
        return true;
      }
    }

    public override bool SupportsInputSettings
    {
      get
      {
        return true;
      }
    }

    public override bool SupportsOutputSettings
    {
      get
      {
        return true;
      }
    }

    public override bool SupportsSearch
    {
      get
      {
        return true;
      }
    }

    public override bool SupportsValidation
    {
      get
      {
        return true;
      }
    }

    public override string SystemTypeName
    {
      get
      {
        return "Decimal";
      }
    }


  }

}

